﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CustomLableIncompleteCode.aspx.cs" Inherits="UI_Bas_CustomLableIncompleteCode" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>CustomLable不完全代码维护</title>   
    <link href="../../css/admin.css" rel="stylesheet" type="text/css" />
    <link href="../../js/jquery.easyui/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../../js/jquery.easyui/themes/icon.css" rel="stylesheet" type="text/css" />
    <script src="../../js/jquery.easyui/jquery.min.js" type="text/javascript"></script>
    <script src="../../js/jquery.easyui/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../js/jquery.easyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
    <script type ="text/javascript" >	
        
      $(function(){ 
        
        var defaultDate = Date.parse('1900/01/01');
        var _$customLableIncompleteCode = $("#customLableIncompleteCode");
        _$customLableIncompleteCode.datagrid({
            border: true,
            height: 345,
            title: 'CustomLable不完全代码列表...',
            remoteSort: false,
            nowrap: true,
            striped: false,
            url: "../../TableHanders.aspx?act=q&tid=29&type=0",
            sortName: 'ProductId',
            sortOrder: 'desc',
            loadMsg: "正在加载,请稍后...",
            toolbar:[{
                    text:'Add',
                    iconCls:'icon-add',
                    handler:function(){
                        window.location.href = "customLableIncompleteCodeDetail.aspx?act=I";
                        return false;              
                    }                    
                   }],
                   
            frozenColumns: [[ 
                    { field: 'opt', title: 'Operation', width: 80, align: 'center',
                        formatter: function(val, row, index) {
                            var Id = row.ProductId; 
                            var Id2=row.ProductId2;                           
                            return  '<a href="#" onclick = "DeleteRow(this);" id = ' + Id +'&id2='+Id2+' rowIndex = ' + index + ' style="color:red;">Delete</a>  '
                                + '<a href = "customLableIncompleteCodeDetail.aspx?act=e&id=' + Id +"&id2="+ Id2 + '">  Eidt</a>';
                        }
                    },                  
	                { title: 'SKU', field: 'ProductId', width:150, sortable: true},
	                { title: '商品编号', field: 'ProductId2', width: 200, sortable: true }
				  ]],				  
            columns: [[	               	                
	                { title: '数量', field: 'Qty', width: 90,sortable: true },	              
	                { title: '操作时间',field: 'Mtime', width: 130, sortable: true, formatter: function(val) {	                   
	                    if(val==null)
	                    {
	                        return "";
	                     }
	                     else 
	                     {
	                        var d = Date.parse(val.replace("-", "/"));
					         if (d == defaultDate) {
					            return "";
					        }
					        else {
					            return val;
					        }
					    }
					}
					}
				]],
		   
            pagination: true,
            rownumbers: true,
            singleSelect: true,
            pageList: [10, 15, 20]                                 
         });          
         $("#btnQuery").click(function() {
            if (!$("#divContent").form('validate'))
                return;
            var productId = $("#txtProductId").val();
            _$customLableIncompleteCode.datagrid({
                queryParams: {
                    "productId": productId                                                                   
                }
            });
        });      
      });
      
       function DeleteRow(row) {
            var rowAttr = $(row);
            var id = rowAttr.attr('id');           
            var rowIndex = rowAttr.attr('rowIndex');
            $.messager.confirm("请确认...", "确认删除?", function(value) {
                if (value) {
                    var url = "../../TableHanders.aspx?act=d&tid=29&type=1&id=" + id;
                    $.getJSON(
                        url,
                        function(data) {
                            var sdata = data[0];
                            var code = sdata.code;
                            if (code == 0) {
                                $("#customLableIncompleteCode").datagrid('deleteRow', rowIndex);
                            }
                            else {
                                alert(sdata.msg);
                            }
                        }
                     );
                }
            });
          }               
	</script>	
</head>
<body> 
  <div class="div_Title">
        <span class="Body_Title">》》<%=this.Title %></span>
    </div>
  <div id="divContent" class="easyui-panel" title="请输入查询条件..." style="margin-bottom:5px;">      
    <form id="formQuery" runat="server">
       <table >
             <tr>
                <td >商品代码:</td>
                <td >
                    <input ID="txtProductId" runat="server" required="true" /></td>  
                <td >              
                   <a id="btnQuery"  href ="#"  class="easyui-linkbutton" icon="icon-search" >Query</a>                     
               </td>
            </tr>
         </table>  
       </form>
    </div>
    <table  id="customLableIncompleteCode"></table>
</body>
</html>

